// 保洁人员表模拟数据
const mock = require("mockjs")
const {Cleaning} = require("../models/Cleaning")
const moment = require("moment")
require("../util/phone")

// 随机生成人员编号
let set = new Set();
for(let i = 0; i< 15; i++){
    set.add(mock.mock("@integer(1000,9999)"))
}

// 生成地区
let economize = []
let market = []
let distinguish = []
for(let i = 0; i < 15;i++){
    let arr = mock.mock("@county(true)").split(" ");
    economize.push(arr[0])
    market.push(arr[1])
    distinguish.push(arr[2])
}
    
const arr = [...set]

const CleaningList = mock.mock({
    "datas|15":[
        {
            "cleaningNumber|+1": arr,
            "cleaningName":"@cname()",
            "cleaningPhone":"@phone()",
            "avatar":"/upload/clen.png",
            "checkInTime":+moment.utc(),
            "economize|+1":economize,
            "market|+1":market,
            "distinguish|+1": distinguish
        }
    ]
}).datas
Cleaning.bulkCreate(CleaningList).then(data => {
    console.log(data);
})